 $(document).ready(function(){
	$('#calendario').fullCalendar({
		selectable: true,
		editable: false,
		events: 'json/',
		dayClick: function(date, allDay, jsEvent, view) {
			data = $.fullCalendar.formatDate(date,'dd-MM-yyyy');
			slot=0;
			$.fancybox({
				'openEffect': 'elastic',
				'closeEffect': 'elastic',
				'type': 'iframe',
				'href': "reserva/"+ slot + "/" +data,
				afterClose: function () {
                	parent.location.reload(true);
            	}
			});
			return false;
		},
		eventClick: function(event) {
			$.fancybox({
				'maxWidth'	: 700,
				'maxHeight'	: 800,
				'openEffect': 'elastic',
				'closeEffect': 'elastic',
				'type': 'iframe',
				'href': event.url
			});
			return false;
		}
	});
	$(function() {
		$("#datepicker").datepicker();
	});	
	$("#formCancela").click(function(e){
		parent.$.fancybox.close();
	});
	$("#formAdd").click(function(e){
		//window.parent.location.href= $("#base_url").val() + "calendario/";
	});
});